package com.google.googlemarket.utils;

/**
 * Created by Administrator on 2017/9/29.
 */

public class ToJson {

    public String getToJson(final String json){
        StringBuilder sb = new StringBuilder();

        for (int i = 0; i < json.length(); i++) {
            char c = json.toCharArray()[i];
            switch (c) {
                case '\"': sb.append("\\\""); break;

                case '\\': sb.append("\\\\"); break;

                case '/': sb.append("\\/"); break;

                case '\b': sb.append("\\b"); break;

                case '\f': sb.append("\\f"); break;

                case '\n': sb.append("\\n"); break;

                case '\r': sb.append("\\r"); break;

                case '\t': sb.append("\\t"); break;

                default: sb.append(c);
                    break;

            }

        }

        return "";
    }

}
